﻿using System;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.Web;
using TimeManager.Web.Controllers;
using TimeManager.Domain.Entities;


namespace TimeManager.Web.Tests.Controllers {

    [TestClass()]
    public class TasksControllerTest {

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Create
        ///</summary>
        // TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        // http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        // whether you are testing a page, web service, or a WCF service.
        [TestMethod()]
        [HostType("ASP.NET")]
        [AspNetDevelopmentServerHost("C:\\Users\\edwards\\Dropbox\\School\\COMP550\\Projects\\Individual\\TimeMgr\\TimeManager.Web", "/")]
        [UrlToTest("http://localhost:1518/")]
        public void CreateTest() {
            TasksController target = new TasksController(); 
            Task task = null; 
            ActionResult expected = null; 
            ActionResult actual;
            actual = target.Create(task);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Edit
        ///</summary>
        // TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        // http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        // whether you are testing a page, web service, or a WCF service.
        [TestMethod()]
        [HostType("ASP.NET")]
        [AspNetDevelopmentServerHost("C:\\Users\\edwards\\Dropbox\\School\\COMP550\\Projects\\Individual\\TimeMgr\\TimeManager.Web", "/")]
        [UrlToTest("http://localhost:1518/Task/Edit/1")]
        public void EditTest() {

            TasksController controller = new TasksController();

            var task = new Task();
            task.Description = "Task to test";
            task.Duration = new TimeSpan(2, 0, 0);
            task.TimeStart = new DateTime(2010, 5, 1);
            task.UserId = 1;
            task.User = new User();
            task.User.UserId = task.UserId;
            task.User.Name = "Joe Smith";
            task.ProjectId = 1;
            task.Project = new Project();
            task.Project.ProjectId = task.ProjectId;
            task.Project.Name = "My Test Project";
            task.Project.Category = new Category();
            task.Project.CategoryId = 1;

            var task2 = new Task();
            task2.Description = "Task to test";
            task2.Duration = new TimeSpan(2, 0, 0);
            task2.TimeStart = new DateTime(2010, 5, 1);
            task2.UserId = 1;
            task2.User = new User();
            task2.User.UserId = task2.UserId;
            task2.User.Name = "Joe Smith";
            task2.ProjectId = 1;
            task2.Project = new Project();
            task2.Project.ProjectId = task2.ProjectId;
            task2.Project.Name = "My Test Project";
            task2.Project.Category = new Category();
            task2.Project.CategoryId = 1;
            ViewResult expected = new ViewResult();

            // ActionResult result = controller.Edit(task2);
            
            // Assert.AreEqual(expected, result);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
